import Vue from 'vue'
import Vuex from 'vuex'
import getters from './module/getter'
import cartStore from './module/cartStore'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    count: 1,
    token: "asjhfashjfsahifhsafhsquhf"
  },
  mutations: {

    setToken (state, token) {
      state.token = token;
    },
    removeToken (state) {
      state.token = ""
    }
  },
  actions: {
    actToken ({ commit }, token) {
      commit("setToken", token)
    }
  },
  getters,//导入的getters放到主模块中管理
  modules: {
    cartStore//注册的分模块名
  }
})
